var interval=setInterval(function () {
    ball.toGravity();
    ball.moveX();
},5);